<?php 
$pPageIsPublic = false;
include '../_common.php';
	
$_SESSION["m1"]="content";
$_SESSION["m2"]='building-list';

?>
<?php include("header.php"); ?>
<script type="text/javascript">
$(document).ready(function() {
	//$('ul.items').admin_sortable("Page");
	$('#select-all').checkedToggle("ul.items", "Page");
	
	
});
</script>
<?php include("sidebar.php"); ?>
<div id="list">
<h2>Buildings</h2>
<form method="post" name="frmFilter" >
<ul id="subnav" style="padding-top:0; padding-bottom: 0; " >
	<li ><label for="select-all" class="first-check" ><input type="checkbox" name="select-all" id="select-all" />Select All</label></li>
	<li ><a href="javascript:void(0);" id="remAll"  >Delete Selecctioned</a></li>
	<li><?php include("filter.php"); ?></li>
	<li class="noborder" >
		<a class="add" href="building-add.php" > Add a New Building </a>
	</li>
</ul>
</form>
<div id="wrap-list">
<?php
	if (is_array(($items = Building::getInstance()->getAllRecords($chkstatus)))) {
		foreach ($items as  $item) {
			$li .= "<li id='recordsArray_". $item["building"] ->id ."'  ><table width='99%' ><tr>";
			$li .= "<td width='4%' ><input type='checkbox' name='items[]' value='{$item["building"] ->id}' /></td>";
			$li .= "<td width='50%' class='nav' ><b>{$item ["building"] ->title}</b><br/>". truncate_string($item ["building"] ->description, 140). "<br/><span class='note-small'>(". strtoupper($item ["building"] ->status).")</span>
						<a title='edit building' href='building-add.php?id=".$item['building'] ->id ."'><img width='16px' height='16px' src='". LBN_ADMIN_IMAGES_ICONS_EDIT ."'/> </a>
						<a title='remove building' href='javascript:void(0);' id='del'  ><img width='16px' height='16px' src='". LBN_ADMIN_IMAGES_ICONS_DELETE ."'/> </a>
			 </td>";
			$li .= "<td width='36%' >". implode(", ", $item["building"] ->getCategoryGrouped() ->title) ."</td>";  	 	
			$li .= "<td width='10%'><p class='subnav'><a href='javascript:void(0);' onclick=\"$.fn.colorbox({iframe:true, innerWidth:'90%',innerHeight:'600',title:'',href:'property/properties.php?id={$item ["building"] ->id}', overlayClose: false});\"  >FILTER</a></p></td></tr>";
			$li .= "</tr></table></li>"; 		
		}		
	} 
?>

	<ul class ="items">
	  <li><table width="99%" >
	  	<tr><th width="4%" >&nbsp;</th><th width="50%" >Building</th><th width="36%"  >Neighborhoods</th><th width="10%">Filter</th></tr></table>
	  </li>
	 <?php echo $li ?>
	</ul>
</div>
</div>
<?php include("footer.php"); ?>